<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            padding: 0;
            margin: 0;
        }

        html,
        body,
        #box {
            height: 100%;
        }

        .page {
            height: 90%;
        }

        .footer {
            height: 10%;
            border-top: 2px solid #222;
        }

        .footer ul {
            height: 100%;
            display: flex;
            justify-content: space-around;
            align-items: center;
        }

        .active {
            color: red;
        }
    </style>
</head>

<body>
    <div id="box">
        <template>
            <component :is='current' class="page"></component>
            <div class="footer">
                <ul>
                    <li @click='current="home"' :class='current=="home"?"active":""'>首页</li>
                    <li @click='current="goods"' :class='current=="goods"?"active":""'>商品</li>
                    <li @click='current="detail"' :class='current=="detail"?"active":""'>详情</li>
                </ul>
            </div>

        </template>
    </div>
    <script src="./js/vue.js"></script>
    <script>
        Vue.component('home', {
            template: `
            <div>首页</div>
            `
        })
        Vue.component('goods', {
            template: `
            <div>商品</div>
            `
        })
        Vue.component('detail', {
            template: `
            <div>详情</div>
            `
        })
        new Vue({
            el: '#box',
            data: {
                current: 'home'
            }
        })
    </script>
</body>

</html>